package com.practice.sequence;

public class MultiplicationOfNumbers {
	public int[] product(int[] a) {
		int N = a.length;
		int[] s = new int[N];
		for (int i=0; i<N; i++) s[i] = 1;
		int left = 1;
		int right = 1;
		
		for (int i=0; i<N; i++) {
			s[i] *= left;
			s[N-i-1] *= right;
			
			left *= a[i];
			right *= a[N-i-1];
		}
		
		return s;
	}
}
